package com.elcom.roaming.common.db;

import org.slf4j.Logger;

import com.elcom.db.DbConnectionPool;
import com.elcom.roaming.common.config.ConfigModule;

public class DBConfig {
	private final Logger logger;
	private DbConnectionPool dbPool;
	private DBQuery dbQuery;

	public DBConfig(Logger logger) {
		this.logger = logger;
		load();
	}

	public DBQuery getDBQuery(){
		return dbQuery;
	}
	
	private void load() {
		dbPool = new DbConnectionPool(logger, ConfigModule.DB_DRIVER, ConfigModule.DB_CONNECT_STRING,
				ConfigModule.DB_USERNAME, ConfigModule.DB_PASSWORD, ConfigModule.DB_MAX_CONNECTION,
				new DBConnectionRefactoryImpl());
		dbQuery = new DBQuery(logger, dbPool);
	}
	
}
